#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc,char* argv[])
{

	if(argc != 3)
	{
		printf("Usage: %s <src file> <obj file>\n",argv[0]);
		return -1;
	}
	int fd_src,fd_obj;
	char buf[32] = {0};
	ssize_t ret;
	fd_src = open(argv[1],O_RDWR);
	if (fd_src < 0)
	{
		printf("open is error\n");
		return -1;
	}
	fd_obj = open(argv[2],O_RDWR | O_CREAT,0666);
	if (fd_obj < 0)
	{
		printf("open is error\n");
		return -1;
	}
	while ((ret = read(fd_src,buf,32))!=0)
	{
		write(fd_obj,buf,32);
	}
	close(fd_src);
	close(fd_obj);
}














